- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathsource.cpp
41 lines (33 loc) · 1.12 KB
/
source.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#using <System.Windows.Forms.dll>
#using <System.Xml.dll>
#using <System.Drawing.dll>
#using <System.dll>
#using <System.Data.dll>
usingnamespaceSystem;
usingnamespaceSystem::Data;
usingnamespaceSystem::ComponentModel;
usingnamespaceSystem::Windows::Forms;
public ref classForm1: publicForm
{
protected:
TextBox^ textBox1;
private:
// <Snippet1>
voidShowGetItemProperties()
{
// Create a new DataTable and add two columns.
DataTable^ dt = gcnew DataTable;
dt->Columns->Add( "Name", Type::GetType( "System.String" ) );
dt->Columns->Add( "ID", Type::GetType( "System.String" ) );
// Add a row to the table.
DataRow^ dr = dt->NewRow();
dr[ "Name" ] = "Ann";
dr[ "ID" ] = "AAA";
dt->Rows->Add( dr );
PropertyDescriptorCollection^ myPropertyDescriptors = this->BindingContext[ dt ]->GetItemProperties();
PropertyDescriptor^ myPropertyDescriptor = myPropertyDescriptors[ "Name" ];
Console::WriteLine( myPropertyDescriptor->Name );
Console::WriteLine( myPropertyDescriptor->GetValue( dt->DefaultView[ 0 ] ) );
}
// </Snippet1>
};